import request from '../utils/request';
import config from '../utils/config';

const { PAGE_SIZE  } = config;
const headers = { 'Content-Type': 'application/json' };
export function fetch({ page = 1, limit = PAGE_SIZE, pathname }) {
  return request('/api/curd', {
    method: 'post',
    headers,
    body: JSON.stringify({ page, limit: PAGE_SIZE, pathname }),
  });
}
export function remove(id) {
  return request('/api/del', {
      method: 'post',
      headers,
      body: JSON.stringify({ id }),
    });
}
export function updata(id, values) {
  return request('/api/updata', {
      method: 'post',
      headers,
      body: JSON.stringify({ id, values }),
    });
}
export function create(values) {
  return request('/api/create', {
      method: 'post',
      headers,
      body: JSON.stringify({ values }),
    });
}
